package com.inheritancedemo;



class Base {
    public int a = 1;
    public int b = 2;

    public void method(){
        System.out.println("BASE::TEST()");
    }
}
class Derived extends Base{
    public int a = 3;
    public int d = 4;

    public void method2(){
        System.out.println("Derived::method2()");
    }

    public void test(){
        method2();
        method();
        /*System.out.println(a);//如果重名类  优先访问自己的
        System.out.println(super.a);//写代码的时候  让这个代码更已读
        System.out.println(this.b);
        System.out.println(d);*/
    }
}

public class TestDemo2 {
    public static void main(String[] args) {
        Derived derived = new Derived();
        derived.test();
    }
}
